# !/usr/bin/python3
# -*- coding: utf-8 -*-
# @Time    : 2021/9/30 13:34
# @Author  : zuodengbo
# @Email   : zuodb@amoydx.com
# @File    : user_schema
# @Software: PyCharm

REGISTER_SCHEMA = {
    "username": {
        "type": "string",
        "minlength": 3,
        "maxlength": 20,
        "required": True,
    },
    "password": {
        "type": "string",
        "maxlength": 64,
        "required": True
    },
    "name": {
        "type": "string",
        "minlength": 1,
        "maxlength": 50,
        "required": True
    },
    "age": {
        "type": "integer",
        "minlength": 1,
        "maxlength": 3,
        "required": False
    },
    "gender": {
        "type": "string",
        "minlength": 1,
        "maxlength": 2,
        "required": False
    },
    "email": {
        "type": "string",
        "maxlength": 32,
        "regex": r"^[0-9a-zA-Z_]{0,19}@[0-9a-zA-Z]{1,13}\.[com,cn,net]{1,3}$",
        "required": False
    },
    "phone": {
        "type": "string",
        "minlength": 11,
        "maxlength": 11,
        "regex": r"[1][345789]\d{9}",
        "required": True
    },
}

LOGIN_SCHEMA = {
    "username": {
        "type": "string",
        "minlength": 3,
        "maxlength": 20,
        "required": True,
    },
    "password": {
        "type": "string",
        "maxlength": 64,
        "required": True
    },
    "verify_code": {
        "type": "string",
        "maxlength": 6,
        "required": True
    },
}

USERS_INFO_SCHEMA = {
    "page_num": {
        "type": "string",
        "minlength": 1,
        "maxlength": 3,
        "required": True,
    },
    "page_size": {
        "type": "string",
        "minlength": 1,
        "maxlength": 4,
        "required": True
    },
}

USERS_JOB_SCHEMA = {
    "username": {
        "type": "string",
        "minlength": 3,
        "maxlength": 20,
        "required": True,
    },
    "job_status": {
        "type": "string",
        "maxlength": 1,
        "required": False
    },
}

ROLE_SCHEMA = {
    "code": {
        "type": "string",
        "maxlength": 32,
        "regex": r"^[0-9a-zA-Z_]{3,32}",
        "required": True,
    },
    "role_name": {
        "type": "string",
        "maxlength": 32,
        "required": True
    },
    "status": {
        "type": "integer",
        "maxlength": 1,
        "required": False
    },
}

AUTHORITY_SCHEMA = {
    "code": {
        "type": "string",
        "maxlength": 32,
        "regex": r"^[0-9a-zA-Z_]{3,32}",
        "required": True,
    },
    "authority_name": {
        "type": "string",
        "maxlength": 32,
        "required": True
    },
    "type": {
        "type": "integer",
        "maxlength": 1,
        "required": True
    },
    "uri": {
        "type": "string",
        "maxlength": 128,
        "required": True
    },
    "status": {
        "type": "integer",
        "maxlength": 1,
        "required": False
    },
    "parent_id": {
        "type": "integer",
        "maxlength": 11,
        "required": False
    },
}

USER_ROLE_SCHEMA = {
    "username": {
        "type": "string",
        "maxlength": 20,
        "required": True,
    },
    "role_name": {
        "type": "string",
        "maxlength": 32,
        "required": True
    },
}

ROLE_AUTHORITY_SCHEMA = {
    "authority_name": {
        "type": "string",
        "maxlength": 32,
        "required": True,
    },
    "role_name": {
        "type": "string",
        "maxlength": 32,
        "required": True
    },
}

USER_INFO_SCHEMA = {
    "username": {
        "type": "string",
        "minlength": 3,
        "maxlength": 20,
        "required": True,
    },
    "birthday": {
        "type": "string",
        "required": False
    },
    "gender": {
        "type": "string",
        "minlength": 1,
        "maxlength": 2,
        "required": False
    },
    "email": {
        "type": "string",
        "maxlength": 32,
        "regex": r"^[0-9a-zA-Z_]{0,19}@[0-9a-zA-Z]{1,13}\.[com,cn,net]{1,3}$",
        "required": False
    },
    "phone": {
        "type": "string",
        "minlength": 11,
        "maxlength": 11,
        "regex": r"[1][345789]\d{9}",
        "required": False
    },
    "company": {
        "type": "string",
        "maxlength": 32,
        "required": False
    },
    "department": {
        "type": "string",
        "maxlength": 32,
        "required": False
    },
    "position": {
        "type": "string",
        "maxlength": 32,
        "required": False
    },
    "position_level": {
        "type": "integer",
        "maxlength": 1,
        "required": False
    },
    "job_num": {
        "type": "string",
        "maxlength": 10,
        "required": False
    },
    "remark": {
        "type": "string",
        "maxlength": 1000,
        "required": False
    },
}
